import math
class Solution:
    def NumberOf1Between1AndN2(self, n):
        res = 0
        s = str(n)
        a = len(s)
        i=1
        while math.pow(10,i)<n:
            if i==1:
                n=n-(i)*10
            else:
                n=n-pow(10,i-1)*9*i
            i+=1
        z = n//(i)
        r = n%(i)
        z =str(z)
        if r>=len(z):
            res = int(z[0])
        else:
            res = int(z[r])
        return res


s = Solution()
print(s.NumberOf1Between1AndN2(1001))